package com.newcoder.leetcode;

import java.util.Arrays;

public class Arrays_singleNumber {

    public static void main(String[] args) {
        int[] arrays = new int[]{};
        int result = new Arrays_singleNumber().singleNumber(arrays);
    }

    public int singleNumber(int[] nums) {
        Arrays.sort(nums);
        for (int i = 0 ; i < nums.length ; i++) {
            if ((i < nums.length - 1) && (nums[i] == nums[i + 1])) {
                i++;
            } else {
                return nums[i];
            }
        }
        return nums[nums.length - 1];
    }
}
